<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<?php $siteName = cr('cmsConfig.Backend.siteName');?>
	<?php echo $html->charset(); ?>
	<title>
	
		<?php
			//use title set for title tag only.else generated title.
			$pageTitle = $this->getVar('pageTitleTag');
			if(strlen($pageTitle) == 0)
			{
				$pageTitle = $title_for_layout;
			}
		?>
		<?php echo $siteName;?> :: <?php echo $pageTitle;?>
	</title>
	
	<script>
	var URL='<?php echo Configure::read("cmsConfig.Backend.siteUrl");?>/';
	var ErrorMsg = <?php echo $encodedErrorMsgs?>;
	</script>
	<?php
		echo $javascript->link(array('/js/jquery-1.7.2.min','/cms/js/main.js','/js/main.js','/cms/js/jquery.cookie.js'));
		echo $html->meta('icon');
		echo $html->meta('keywords',$this->getVar('metaKeywords'));
		echo $html->meta('description',$this->getVar('metaDescription'));
		echo $html->defaultCss(array('/cms/css/mod','/cms/css/mod_skins'));
		echo $html->css('common');
		echo $html->css('style');
		echo $html->css('breadcrumb');
		echo $javascript->getCompressedJs();
		echo $scripts_for_layout;
		echo $html->getCompressedCss();
		echo $startup_js;
		
		$metaCanonicalUrl = $this->getVar('metaCanonicalUrl');
		if($metaCanonicalUrl)
		{
			echo $html->meta(array('rel'=>'canonical'),null,array('link'=>Configure::read("cmsConfig.Backend.siteUrl").$metaCanonicalUrl));
		}
	?>
	<!--[if IE]> <?php echo $html->css('IE');?> <![endif]-->
</head>

<body>
<?php 
if(!isset($hideSideBars))
{
	$hideSideBars = false;
}
?>
<div id="container">
	<div class="top">
		<div class="wrapper">
			<div class="header">
				<div class="logo">
					<?php 
				echo $this->
					element('site_logo'); ?>
				</div>
				<div class="header_right">
					<div class="header_banner">
						<?php
				if(isset($section))
				{
					echo $section->
						render('header_right'); } ?>
					</div>
					<div class="clear">
					</div>
					<?php echo $this->
					element('navigation_links');?>
					<div class="clear">
					</div>
				</div>
				<div class="header-links">
					<?php if(@$session->
					read('Auth.User')) {?>
					<ul class="logged-in-nav">
						<li>
						<a class="header-button" href="/users/profile">My Profile</a>
						</li>
						<li class="login">
						<a href="/users/logout">
						Log Out </a>
						</li>
					</ul>
					<?php }else{?>
					<ul class="logged-out-nav">
						<li>
						<a class="header-button" href="/users/register">Sign Up</a>
						</li>
						<li class="login">
						<a href="/users/login">
						Log In </a>
						</li>
					</ul>
					<?php }?>
				</div>
			</div>
			<div class="clear">
			</div>
		</div>
	</div>
	<div class="wrapper">
		<!--<?php
					if(isset($section))
					{
						echo $section->render('after_nav');
					}
				?>-->
		<div class="main_content">
			<?php 
					if(!isset($breadCrumbVars))
					{
						$breadCrumbVars = array();
					}					
					if(cr('GeneralConfig.enable_breadcrumb') == 1)
					{
						if(isset($breadCrumb))
						{	
							$breadCrumb->
			breadCrumbElement = "bread_crumb_app"; echo $breadCrumb->showFromPresentUrl(); } } ?>  <?php
					if(isset($section))
					{
						//meant for cities block mainly.
						echo '<div class="change_city">';
						echo $section->
			render('location_bar'); } ?>
			<?php echo '</div>';?>

			<div class="clear">
			</div>
			<?php 
					$session->
			flash(); ?>
			<div class="rightCol sidebar">
				<?php
					if(isset($section) && $hideSideBars===false)
					{
						echo $section->
				render('right_sidebar'); } ?>
			</div>
			<div class="main">
				<div class="clear">
				</div>
				<div class="mid_box">
					<?php if((!isset($hideLayoutTitle) || $hideLayoutTitle != true) && $this->
					pageTitle){?>
					<h2><?php echo $this->
					pageTitle;?></h2>
					<?php }?>
					<?php
				if(isset($section))
				{
					echo $section->
					render('top'); } ?> <?php echo $content_for_layout; ?>
					<?php
				if(isset($section))
				{
					echo $section->
					render('bottom'); } ?>
				</div>
			</div>
			<div class="clear">
			</div>
			<center>
			<?php
				if(isset($section))
				{
					echo $section->
			render('footer_ad'); } ?> </center>
		</div>
		<div class="clear">
		</div>
		<?php echo $this->
		element("footer")?>
	</div>
</div>
<?php echo $cakeDebug; ?>
</body>
</html>